home *** CD-ROM | disk | FTP | other *** search
- class LevelManager extends MovieClip
- {
- static var wm;
- static var title;
- static var displayBox;
- static var level = 0;
- static var pausable = false;
- function LevelManager()
- {
- super();
- LevelManager.signal();
- }
- static function addStuffTest()
- {
- LevelManager.wm = new WaveManager(210,360);
- var _loc1_ = 0;
- while(_loc1_ < 3 * LevelManager.level)
- {
- LevelManager.wm.push("Enemy");
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 2 * LevelManager.level - 2)
- {
- LevelManager.wm.push("MovingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 1.5 * LevelManager.level - 3)
- {
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 0.5 * LevelManager.level - 1.5)
- {
- LevelManager.wm.push("TeleportingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 0.5 * LevelManager.level - 2)
- {
- LevelManager.wm.push("StraightEnemy");
- _loc1_ = _loc1_ + 1;
- }
- }
- static function populateWave()
- {
- switch(LevelManager.level)
- {
- case 1:
- LevelManager.title = "Getting your feet wet";
- LevelManager.wm = new WaveManager(60,120,1);
- var _loc1_ = 0;
- while(_loc1_ < 6)
- {
- LevelManager.wm.push("Enemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 2:
- LevelManager.title = "Here they come!";
- LevelManager.wm = new WaveManager(90,150,2);
- _loc1_ = 0;
- while(_loc1_ < 12)
- {
- LevelManager.wm.push("Enemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 3:
- LevelManager.title = "New and improved!";
- LevelManager.wm = new WaveManager(60,120,1);
- _loc1_ = 0;
- while(_loc1_ < 6)
- {
- LevelManager.wm.push("Enemy");
- _loc1_ = _loc1_ + 1;
- }
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("MovingEnemy");
- break;
- case 4:
- LevelManager.title = "Medley";
- LevelManager.wm = new WaveManager(90,150,2);
- _loc1_ = 0;
- while(_loc1_ < 6)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 5:
- LevelManager.title = "Restless";
- LevelManager.wm = new WaveManager(60,90,1);
- _loc1_ = 0;
- while(_loc1_ < 8)
- {
- LevelManager.wm.push("MovingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 6:
- LevelManager.title = "Suicidal";
- LevelManager.wm = new WaveManager(60,90,1);
- _loc1_ = 0;
- while(_loc1_ < 6)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 3)
- {
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 7:
- LevelManager.title = "Escalation";
- LevelManager.wm = new WaveManager(90,150,2);
- _loc1_ = 0;
- while(_loc1_ < 8)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 8:
- LevelManager.title = "They come in threes";
- LevelManager.wm = new WaveManager(120,180,3);
- _loc1_ = 0;
- while(_loc1_ < 10)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 9:
- LevelManager.title = "Just dodge";
- LevelManager.wm = new WaveManager(420,420,4);
- _loc1_ = 0;
- while(_loc1_ < 12)
- {
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 10:
- LevelManager.title = "Huh?";
- LevelManager.wm = new WaveManager(90,150,2);
- _loc1_ = 0;
- while(_loc1_ < 6)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 3)
- {
- LevelManager.wm.push("TeleportingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 11:
- LevelManager.title = "Medley II";
- LevelManager.wm = new WaveManager(120,180,3);
- _loc1_ = 0;
- while(_loc1_ < 12)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- LevelManager.wm.push("TeleportingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 12:
- LevelManager.title = "Green mayhem";
- LevelManager.wm = new WaveManager(90,150,2);
- _loc1_ = 0;
- while(_loc1_ < 12)
- {
- LevelManager.wm.push("TeleportingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 13:
- LevelManager.title = "Lucky thirteen";
- LevelManager.wm = new WaveManager(60,90,13);
- _loc1_ = 0;
- while(_loc1_ < 4)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- LevelManager.wm.push("TeleportingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- LevelManager.wm.push("Enemy");
- break;
- case 14:
- LevelManager.title = "Four of \'em";
- LevelManager.wm = new WaveManager(150,210,4);
- _loc1_ = 0;
- while(_loc1_ < 20)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- LevelManager.wm.push("TeleportingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 15:
- LevelManager.title = "Don\'t blink!";
- LevelManager.wm = new WaveManager(60,90,2);
- _loc1_ = 0;
- while(_loc1_ < 50)
- {
- LevelManager.wm.push("TeleportingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 16:
- LevelManager.title = "Snipers";
- LevelManager.wm = new WaveManager(90,150,2);
- _loc1_ = 0;
- while(_loc1_ < 6)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- LevelManager.wm.push("TeleportingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 3)
- {
- LevelManager.wm.push("StraightEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 17:
- LevelManager.title = "Medley III";
- LevelManager.wm = new WaveManager(120,180,3);
- _loc1_ = 0;
- while(_loc1_ < 12)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- LevelManager.wm.push("TeleportingEnemy");
- LevelManager.wm.push("StraightEnemy");
- _loc1_ = _loc1_ + 1;
- }
- _loc1_ = 0;
- while(_loc1_ < 3)
- {
- LevelManager.wm.push("SelfDestructingEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 18:
- LevelManager.title = "Citrus";
- LevelManager.wm = new WaveManager(90,150,2);
- _loc1_ = 0;
- while(_loc1_ < 15)
- {
- LevelManager.wm.push("StraightEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 19:
- LevelManager.title = "Last stand";
- LevelManager.wm = new WaveManager(150,240,5);
- _loc1_ = 0;
- while(_loc1_ < 20)
- {
- LevelManager.wm.push("Enemy");
- LevelManager.wm.push("MovingEnemy");
- LevelManager.wm.push("SelfDestructingEnemy");
- LevelManager.wm.push("TeleportingEnemy");
- LevelManager.wm.push("StraightEnemy");
- _loc1_ = _loc1_ + 1;
- }
- break;
- case 20:
- LevelManager.title = "Back to the beginning";
- LevelManager.wm = new FinaleWaveManager();
- }
- }
- static function resetPlayer()
- {
- _root.player.getMovie()._x = Stage.width >> 1;
- _root.player.getMovie()._y = Stage.height >> 1;
- _root.player.getMovie()._rotation = 0;
- }
- static function start()
- {
- LevelManager.pausable = true;
- LevelManager.displayBox.removeMovieClip();
- _root.debrisField.dimField();
- Stepper.unpause();
- }
- static function signal()
- {
- LevelManager.pausable = false;
- _root.kongregateStats.submit("MaxLevel",LevelManager.level);
- LevelManager.level = LevelManager.level + 1;
- LevelManager.wm.die();
- LevelManager.populateWave();
- Stepper.pause();
- LevelManager.resetPlayer();
- LevelManager.display("Level " + LevelManager.level + ": " + LevelManager.title);
- }
- static function signalFinished()
- {
- _root.kongregateStats.submit("GameComplete",1);
- ScoreManager.addScore(ScoreManager.getScore() * 0.1);
- LevelManager.restart();
- LevelManager.displayScore("Congratulations! You win!");
- }
- static function signalDeath()
- {
- LevelManager.restart();
- LevelManager.displayScore("You died!");
- }
- static function restart()
- {
- _root.kongregateStats.submit("Score",ScoreManager.getScore());
- LevelManager.pausable = false;
- LevelManager.level = 0;
- LevelManager.wm.die();
- LevelManager.wm = null;
- var _loc3_ = 0;
- while(_loc3_ < 10)
- {
- var _loc2_ = 0;
- while(_loc2_ < Enemy.enemies.size())
- {
- Enemy.enemies["get"](_loc2_).die();
- _loc2_ = _loc2_ + 1;
- }
- _loc2_ = 0;
- while(_loc2_ < Missile.missiles.size())
- {
- Missile.missiles["get"](_loc2_).die();
- _loc2_ = _loc2_ + 1;
- }
- _loc3_ = _loc3_ + 1;
- }
- _root.player.die();
- _root.hm = new HudManager();
- }
- static function display(msg)
- {
- LevelManager.displayBox = _root.attachMovie("levelDisplayBox","levelDisplayBox" + _root.getNextHighestDepth(),_root.getNextHighestDepth());
- LevelManager.displayBox._x = Stage.width >> 1;
- LevelManager.displayBox._y = Stage.height >> 1;
- LevelManager.displayBox.lvlText = msg;
- }
- static function displayScore(msg)
- {
- LevelManager.displayBox = _root.attachMovie("scoreDisplayBox","scoreDisplayBox" + _root.getNextHighestDepth(),_root.getNextHighestDepth());
- LevelManager.displayBox._x = Stage.width >> 1;
- LevelManager.displayBox._y = Stage.height >> 1;
- LevelManager.displayBox.score = "Score: " + ScoreManager.getScore();
- LevelManager.displayBox.lvlText = msg;
- }
- static function isPausable()
- {
- return LevelManager.pausable;
- }
- }
-